package interfaz;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.layout.ColumnLayout;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.widgets.TextBox;
import org.uqbar.arena.windows.Dialog;
import org.uqbar.arena.windows.SimpleWindow;
import org.uqbar.arena.windows.WindowOwner;

import adapter.MesaAdapter;

public class CambiarFichasWindow extends Dialog<MesaAdapter>{
	

	public CambiarFichasWindow(WindowOwner parent, MesaAdapter model) {
		super(parent, model);
	}
	
	public void createMainTemplate(Panel mainPanel) {
		mainPanel.setLayout(new ColumnLayout(2));
		
		this.setTitle("Cambiar fichas");

		Label apostar = new Label(mainPanel);
		apostar.setText("Usted posee ");
		
		Label fichas = new Label(mainPanel);
		fichas.bindValueToProperty(MesaAdapter.FICHAS);
		
		Label desea = new Label(mainPanel);
		desea.setText("¿Cuantas desea? " + "\n");
		
		
		TextBox cantidad = new TextBox(mainPanel);
		this.getModel();
		cantidad.bindValueToProperty(MesaAdapter.FICHASPARACAMBIAR);

			
		Button aceptar = new Button(mainPanel);	
		aceptar.setCaption("Aceptar");
		aceptar.disableOnError(); //$#"$%&
		aceptar.onClick(new MessageSend(this, ACCEPT))
		.setAsDefault()
		.disableOnError();;
			
		Button Cancelar = new Button(mainPanel);
		Cancelar.setCaption("Cancelar");
		Cancelar.onClick(new MessageSend(this,CANCEL));
		
	}

	@Override
	protected void addActions(Panel mainPanel) {	
	}
	@Override
	protected void createFormPanel(Panel mainPanel) {
	
	}
	
	@Override
	protected void executeTask() {
		this.getModel().actualizarJugador();
	}


	
}
